/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author cloud15
 */
public class DateUtil {

    public static String getCheckPointDate(Date d) {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
        return sdf.format(d);
    }

    public static String getCheckPointTime(Date d) {

        return String.valueOf(d.getTime());
    }

    public static void main(String... args) throws IOException {
        System.out.println(DateUtil.getCheckPointTime(new Date()));

        String exe = "ls /mnt/drbd7/";
        System.out.println(exe);
        Process p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "ls /mnt/drbd7/i* | tail -1"});
        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String pOut = in.readLine();
        System.out.println(pOut);
    }
}
